class Solution {
public:
    bool IsPopOrder(vector<int> pushV,vector<int> popV) {
        stack<int> st;
        size_t pushi=0,popi=0;
        while(pushi<pushV.size())
        {
            
             st.push(pushV[pushi]);
             pushi++;
            
            
            
          while(!st.empty()&&popV[popi]==st.top())
          {
              st.pop();
              popi++;
          }
                 
             
             
            
           
        }
        return st.empty();
    }
};